package com.dyit.exception.handler;

import com.dyit.dto.HttpResp;
import com.dyit.exception.Book.BookAlreadyExistsException;
import com.dyit.exception.user.*;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class UserExceptionHandler {
    @ExceptionHandler
    public HttpResp accountBlankException(AccountBlankException e){
        return new HttpResp(40001,e.getMessage(),null,null);
    }

    @ExceptionHandler
    public HttpResp accountNotExistException(AccountNotExistException e){
        return new HttpResp(40002,e.getMessage(),null,null);
    }

    @ExceptionHandler
    public HttpResp passwordBlankException(PasswordBlankException e){
        return new HttpResp(40003,e.getMessage(),null,null);
    }
    @ExceptionHandler
    public HttpResp passwordIncorrectException(PasswordIncorrectException e){
        return new HttpResp(40005,e.getMessage(),null,null);
    }
    @ExceptionHandler
    public HttpResp BookAlreadyExistsException(BookAlreadyExistsException e){
        return new HttpResp(40006,e.getMessage(),null,null);
    }
    @ExceptionHandler
    public HttpResp AccountAndPasswordBlankException(AccountAndPasswordBlankException e){
        return new HttpResp(40007,e.getMessage(),null,null);
    }
    @ExceptionHandler
    public HttpResp AccountExistsException(AccountExistsException e){
        return new HttpResp(40008,e.getMessage(),null,null);
    }
    @ExceptionHandler
    public HttpResp IncorrectPerException(IncorrectPerException e){
        return new HttpResp(40009,e.getMessage(),null,null);
    }

}
